package iot.cassandra;

import com.datastax.driver.mapping.BaseDao;
import com.datastax.driver.mapping.CassandraMapper;
import com.datastax.driver.mapping.MapperFactory;
import iot.entity.Registration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

/**
 * Created by dave on 18-7-26 下午1:26.
 */
@Service
@ConditionalOnProperty(name = "dao.type", havingValue = "cassandra")
public class CassRegistrationDao implements BaseDao<Registration> {
    private CassandraMapper<Registration> mapper;

    public CassRegistrationDao(MapperFactory factory) {
        mapper = factory.mapper(Registration.class);
    }

    @Override
    public CassandraMapper<Registration> getMapper() {
        return mapper;
    }
}
